package com.oo.inherit_3.automobile;

/**
 * Truck--${description}
 *
 * @author: Jovi
 * @createTime: 2017-05-09 14:01
 **/
public class Truck extends Bus {

    private int load;

    public Truck() {
    }

    public Truck(String licensNo, String color, String name, double dailyRent, int load) {
        super(licensNo, color, name, dailyRent);
        this.load = load;
    }

    @Override
    protected void hire(String name, int day) {
        if (day < 0) {
            System.out.println("日期无效");
            return;
        }
        double money = 0;
        if (day <= 10) {
            money = day * this.getDailyRent();
        } else {
            money = day * this.getDailyRent() + (day - 10)
                    * this.load * this.getDailyRent() * 0.1;
        }
        String msg = "租赁信息\n车牌号：" + this.getLicensNo()
                + "\n车型：" + this.getName() + "\n颜色：" + this.getColor()
                + "\n载重量：" + this.getLoad() + "\n租车人" + name + "\n应付金额" + money;

        System.out.println(msg);
    }

    public int getLoad() {
        return load;
    }

    public void setLoad(int load) {
        this.load = load;
    }
}
